package cn.hiapi.admin.query;

import cn.hiapi.basic.jpa.pageable.QueryWrapper;
import cn.hiapi.basic.jpa.query.BasicQuery;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * @author AdinZ
 * @date 2023/2/5 3:44
 */
@Setter
@Getter
public class ActivityGroupOrderQuery extends BasicQuery {
    private String shopName;

    private List<Long> shopIds;
    private String mobile;

    private Long uid;

    private String title;

    private Integer status;

    private Long[] time;

    private Long aid;

    @Override
    public QueryWrapper getQueryWrapper() {
        QueryWrapper wrapper = super.getBasicQueryWrapper();
        wrapper.eq("status", status);
        wrapper.like("shopId", shopIds);
        wrapper.eq("buyerId", uid);
        wrapper.eq("aid", aid);
        wrapper.between("created", time);
        if (StringUtils.isNotEmpty(title)) {
            wrapper.like("title", StringUtils.join("%", title, "%"));
        }
        return wrapper;
    }
}
